<%@ page language="java" import="java.util.*,java.net.URLDecoder" pageEncoding="utf-8"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
String loginName="";
String uid="";
Cookie[] cookArr = request.getCookies();
if(cookArr!=null){
	for(Cookie c:cookArr){
		if(c.getName().equals("LOGINNAME")){
			loginName = URLDecoder.decode(c.getValue(),"UTF-8");
		}
		if(c.getName().equals("UID")){
			uid = c.getValue();
		}
		c.getValue();
	}
}
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"

<html>
	<head>
	    <title>主页</title>
		<meta http-equiv="pragma" content="no-cache">
		<meta http-equiv="cache-control" content="no-cache">
		<meta http-equiv="expires" content="0">    
		<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
		<meta http-equiv="description" content="This is my page">
	</head>
	<body>
		
		<h3 align="left">分页查询</h3>
		<!-- 数据部分 -->
		<table  align="left" border="1px solid pink" style="text-align: center;font-size: 14px;margin-top:0px;" >
			<tbody>
				<tr>
					<td>用户编号</td>
					<td>用户姓名</td>
					<td>用户密码</td>
				</tr>
				<c:forEach items="${user_list}" var="user">
					<tr>
						<td>${user.sname}</td>
						<td>${user.price}</td>
						<td>${user.stock}</td>		
					</tr>		
				</c:forEach>
			</tbody>
		</table>
		<br>
		<!-- 分页按钮部分 -->
		<%-- <p>一共${page.pages}页</p>
		<a href="queryAll.do?page=${page.firstPage}&uid=<%=uid%>">第一页</a>
		<a href="queryAll.do?page=${page.nextPage}&uid=<%=uid%>">下一页</a> 
		<a href="queryAll.do?page=${page.prePage}&uid=<%=uid%>">上一页</a> 
		<a href="queryAll.do?page=${page.lastPage}&uid=<%=uid%>">最后页</a> --%>


				<div class="box-footer">
					<div class="pull-left">
						<div class="form-group form-inline">
							总共${page.pages} 页，共${page.total} 条数据。
						</div>
					</div>

					<div class="box-tools pull-right">
						<ul class="pagination">
							<%--在超链接中访问js函数，必须加前缀：javascript--%>
							<li><a href="queryAll.do?page=${page.firstPage}&uid=<%=uid%>">首页</a></li>
							<li><a href="queryAll.do?page=${page.prePage}&uid=<%=uid%>">上一页</a></li>

							<%--begin:从哪儿开始--%>
							<%--end:到哪儿结束--%>
							<c:forEach begin="${page.firstPage}" end="${page.lastPage}" var="i">
								<li><a href="queryAll.do?page=${i}&uid=<%=uid%>">${i}</a></li>
								
							</c:forEach>
							<li><a href="queryAll.do?page=${page.nextPage}&uid=<%=uid%>">下一页</a></li>
							<li><a href="queryAll.do?page=${page.lastPage}&uid=<%=uid%>">尾页</a></li>
						</ul>
					</div>
	</body>
</html>
